import { AREA } from '../../constance';
import { fiterDefdoc, fiterLrzxOrg } from '../../../../common/util/fiterUtils';

/*
 * @Author: nccloud
 * @PageInfo: 表体编辑前事件
 */
export default async function (props, moduleId, key, value, oldvalue, refinfo) {
        let meta = props.meta.getMeta();
        if (moduleId == AREA.cardBody_1 && (key == 'vbdef3' || key == 'vbdef4')) {
                let vdef1 = props.form.getFormItemsValue(AREA.cardHead, 'vdef1').value;
                let where = "def1 in (select pk_org from org_orgs where dr=0 and name in (select name from org_orgs where pk_org='"+vdef1+"')) and def7='Y'";
                fiterDefdoc(props, moduleId, key, where);
        }

        if ((moduleId == AREA.cardBody_1 && (key == 'vbdef2')) || (moduleId == AREA.cardBody_2 && (key == 'vbdef2'))) {
                let isDataPowerEnable = false;
                let isMultiSelectedEnabled = false;
                fiterLrzxOrg(props, moduleId, key, isDataPowerEnable, isMultiSelectedEnabled);
        }

        return true;
}
